<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="__PUBLIC__/styles/pintuer.css">
<link rel="stylesheet" href="__PUBLIC__/styles/admin.css">
<link rel="stylesheet" href="__PUBLIC__/vendor/fontawesome/css/font-awesome.css" />
<link rel="stylesheet" href="__PUBLIC__/vendor/metisMenu/dist/metisMenu.css" />
<link rel="stylesheet" href="__PUBLIC__/vendor/animate.css/animate.css" />
<link rel="stylesheet" href="__PUBLIC__/vendor/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="__PUBLIC__/vendor/sweetalert/lib/sweet-alert.css" />
<link href="__UPLOADIFY__/common.css" rel="stylesheet" type="text/css" />
<!-- App styles -->
<link rel="stylesheet" href="__PUBLIC__/fonts/pe-icon-7-stroke/css/pe-icon-7-stroke.css" />
<link rel="stylesheet" href="__PUBLIC__/fonts/pe-icon-7-stroke/css/helper.css" />
<link rel="stylesheet" href="__PUBLIC__/styles/style.css">
<script src="__PUBLIC__/scripts/jquery.js"></script>
<script src="__PUBLIC__/scripts/pintuer.js"></script>
<script src="__PUBLIC__/vendor/jquery/dist/jquery.min.js"></script>
<script src="__LAYER__/layer.js"></script>
<script src="__AJAXFILEUPLOAD__/ajaxfileupload.js" type="text/javascript"></script>
<!--<script src="__PUBLIC__/vendor/bootstrap/dist/js/bootstrap.min.js"></script>-->
<!--<script type="text/javascript" src="__UPLOADIFY__/jquery.uploadify.min.js"></script>-->
</head>
<body>
<div class="panel admin-panel margin-top">
  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>资料管理</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" action="">
      <div class="form-group">
        <div class="label">
          <label>姓名：</label>
        </div>
        <div class="field">
          <span>{$doctor_info.name}</span>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>身份证号码：</label>
        </div>
        <div class="field">
          <span>{$doctor_info.id_no}</span>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>*联系电话：</label>
        </div>
        <div class="field">
          <input type="text" id="doctor-phone" class="input w50" name="phone" value="{$doctor_info.phone}" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>技能标签：</label>
        </div>
        <div class="field">
          <input type="text" id="doctor-skill" class="input w50" name="skill" value="{$doctor_info.skill}" />
          <div class="tipss">多项请用逗号‘，’隔开</div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>头像：</label>
        </div>
        <div class="field">
          <input type="file" name="headlog" class="button bg-blue margin-left" accept="image/*" id="logo-upload" style="float:left;"><button type="button" id="dianji">点击上传</button>
          <div class="tipss" id="logo-preview"><img src="{$doctor_info.headurl}" width="60px" height="60px" style="border-radius: 50%"></div>
          <input type="hidden" id="head-logo" name="headurl" value="{$doctor_info.headurl}">
        </div>
      </div>
      <!--<div class="form-group">-->
        <!--<div class="label">-->
          <!--<label>头像：</label>-->
        <!--</div>-->
        <!--<div class="field">-->
          <!--<input type="file" class="button bg-blue margin-left" id="logo-upload" style="float:left;">-->
          <!--<div class="tipss" id="logo-preview"><img src="{$doctor_info.headurl}" width="60px" height="60px" style="border-radius: 50%"></div>-->
          <!--<input type="hidden" id="head-logo" name="headurl" value="{$doctor_info.headurl}">-->
        <!--</div>-->
      <!--</div>-->
      <div class="form-group">
        <div class="label">
          <label>我的简介：</label>
        </div>
        <div class="field">
          <textarea type="text" id="doctor-content" class="input w50" name="content" style="height:150px;" placeholder="我的介绍">{$doctor_info['content']}</textarea>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <div id="img-url"></div>
            <input id="doctor-id" type="hidden" name="id" value="{$doctor_info.id}">
          <button class="button bg-main icon-check-square-o" id="submit-content" type="button"> 提交</button>
        </div>
      </div>
    </form>
  </div>
</div>

<script>


    $("#dianji").click(function () {
        layer.msg('请等待', {
            icon: 16
            ,shade: 0.1
        });
        $.ajaxFileUpload({
            url: '{:U("Auditing/Index/ajaxHeadImg")}', //用于文件上传的服务器端请求地址
            secureuri: false, //是否需要安全协议，一般设置为false
            fileElementId: 'logo-upload', //文件上传域的ID
            dataType: 'JSON', //返回值类型 一般设置为json
            success: function (data, status)  //服务器成功响应处理函数
            {
                var res = eval("("+data+")");
                if(res.status == '1'){
                    var file_url = res.url;
//                    //将图片路径放入到隐藏域中
                    $('#head-logo').val(file_url);
                    $('#logo-preview').html('<img src="'+file_url+'" width="60px" height="60px" style="border-radius: 50%">');
                    layer.msg(res.msg, {icon: 6});
                }else{
                    layer.msg(res.msg, {icon: 5});
                }

            },
            error: function (data, status, e)//服务器响应失败处理函数
            {
                alert(e);
            }
        })
    })

//    $('#logo-upload').uploadify({
//        'swf'      : '__UPLOADIFY__/uploadify.swf',
//        'uploader' : '{:U("Auditing/Index/ajaxHeadImg")}',
//        'buttonText':' 选择文件...',
//        'onUploadSuccess':function(file,response){
//            //是否上传成功
//            var data = eval("("+response+")");
//            if(data){
//                var file_url = data.url;
////                    //将图片路径放入到隐藏域中
//                $('#head-logo').val(file_url);
//                $('#logo-preview').html('<img src="'+file_url+'" width="60px" height="60px" style="border-radius: 50%">');
//                layer.msg(data.msg, {icon: 6});
//            }else {
//                layer.msg(data.msg, {icon: 5});
//            }
//        }
//    });


    $('#submit-content').click(function () {
        if(confirm('确定修改您的信息吗？')){
            var phone = $('#doctor-phone').val();
            var skill = $('#doctor-skill').val();
            var headurl = $('#head-logo').val();
            var content = $('#doctor-content').val();
            var id = $('#doctor-id').val();
            layer.msg('请等待', {
                icon: 16
                ,shade: 0.1
            });
            $.ajax({
                type: "post",
                url:"{:U('Auditing/Index/ajaxManageDoctor')}",
                async: true,
                dataType: 'json',
                data: {
                    'phone':phone,
                    'skill':skill,
                    'headurl':headurl,
                    'content':content,
                    'id':id
                },
                success: function(data) {
                    if(data.status == '1'){
                        layer.msg(data.msg, {icon: 6});
                    }else {
                        layer.msg(data.msg, {icon: 5});
                    }
                },
                error: function(xhr, type, errorThrown) {
                    layer.msg('网络连接失败', {icon: 2});
                }
            });
        }
    })


</script>
</body>
</html>